import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect:'/home',
      component: () => import('../views/home/index.vue')
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/login.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/home/index.vue'),
      children:[
        {
          path:'/novelManager',
          name:'novelManager',
          meta:{
            title:'小说管理'
          },
          component:()=>import('../views/novelManager/novelManager.vue')
        },
        {
          path:'/novelQuery',
          name:'novelQuery',
          meta:{
            title:'小说查询'
          },
          component:()=>import('../views/novelManager/novelQuery.vue')
        },
        {
          path:'/novelType',
          name:'novelType',
          meta:{
            title:'小说类型'
          },
          component:()=>import('../views/novelManager/novelType.vue')
        },
        {
          path:'/readManager',
          name:'readManager',
          meta:{
            title:'阅读管理'
          },
          component:()=>import('../views/readManager/readManager.vue')
        },
        {
          path:'/configuration',
          name:'configuration',
          meta:{
            title:'配置管理'
          },
          component:()=>import('../views/configuration/configuration.vue')
        },
        {
          path:'/flowPathQuery',
          name:'flowPathQuery',
          meta:{
            title:'流量查询'
          },
          component:()=>import('../views/readManager/flowPathQuery.vue')
        }
      ]
    }
  ]
})

export default router
